#include<bits/stdc++.h>
using namespace std;
int a[25];
int n , m;
double ans;
double work(){
	double ret = 0;
	int amin = 11 , amax = 0;
	for(int i = 1 ; i <= m ; i++){
		ret = ret + a[i];
		if(a[i] > amax){
			amax = a[i];
		}
		if(a[i] < amin){
			amin = a[i];
		}
	}
	ret = ret - amax - amin;
	ret = ret / (m - 2);
	return ret;
}
int main(){
	freopen("match.in" , "r" , stdin);
	freopen("match.out" , "w" , stdout);
	cin >> n >> m;
	for(int i = 1 ; i <= n ; i++){
		for(int j = 1 ; j <= m ; j++){
			cin >> a[j];
		}
		ans = max(ans , work());
	}
	printf("%.2lf\n" , ans);
	return 0;
}